DateAdd
Definition:
DateAdd(interval, number, date)
Description:
Add a specified time interval to a date string.
Platforms:
All
Parameters:
interval - required
The type of time unit you want to add. Possible values are:
"d" - Day
"w" - Weekday (same as "d")
"y" - Day of year (same as "d")
"m" - Month
"yyyy" - Year
"h" - Hour
"n" - Minute
"s" - Second
"ww" - Week
"q" - Quarter (3 months)
number - required
The number of the specified type of time units to add.
date - required
String containing the date, date and time or time to be modified.
Supported formats for this parameter are the same as those supported by VBScript DateTime objects.
Returns:
String containing the new date in the format determined by the standard date/time related settings on the local machine.
Notes:
If you are adding a month to a date, this Method will increase the month by one, so that 30/10 plus one month will be 30/11.
However, in some situations what would be the resulting month doesn't have enough days, e.g. 30/01 + I month would be the 30/02, but obviously February only has 28 or 29 days depending upon whether it's a leap year. In this situation, the Method subtracts the number of possible days in what should be the resulting month from the required date and adds the difference to the beginning of the month after that.
For example, 29/01/2015 + 1 month = 01/03/2015 because February only has 28 days so it subtracts the number of available days, 28, from the required date, 29th, which = 1 and adds this to the beginning of the next month giving the 1st March. Likewise, 30/01/2015 + 1 month = 02/03/2015 since 30-28 = 2, so it adds two days to the beginning of the next month, March.
If you want to use the current date and time, you can use the Now Method to obtain this in a suitable format for use within this Method.